﻿function alertBox(boxcallback, callbackParameter, title, info) {//返回函数、返回参数、标题、内容
    var msgObj = document.createElement("div");

    msgObj.setAttribute("id", "MyidBox");
    msgObj.setAttribute("class", "lightbox");
    msgObj.style.width = "280px";
    msgObj.style.height = "auto";
    msgObj.style.background = "rgb(255, 255, 255) none repeat scroll 0% 0%";
    msgObj.style.borderRadius = "4px";
    msgObj.style.padding = "10px 16px";
    msgObj.style.boxShadow = "0 0 0 0 #fff";
    msgObj.style.position = "fixed";
    msgObj.style.top = "45%";
    msgObj.style.left = "45%";
    msgObj.style.minHeight = "130px";
    msgObj.style.minWidth = "240px";


    var boxInfo = "<div style=\"border-bottom: 1px dashed #4d96df;text-align: left; color: #588cd2; font-size: 20px; overflow: hidden;padding: 10px 0; text-overflow: ellipsis; white-space: nowrap;\">" + title + "</div><div style=\"font-size: 14px;text-align: left; line-height: 1.6; padding: 14px 0 10px; text-indent: 16px;color: #313234;\">" + info + "</div><div style=\"display: flex; float: right; height: 36px; justify-content: flex-end;overflow: hidden; padding: 3px 2px; text-overflow: ellipsis; white-space: nowrap;\"><span id=\"MybtnClose\" data-name=\"确定\" style=\"margin-right: 10px; background: #4d96df none repeat scroll 0 0;color: #fff; -moz-user-select: none; border-radius: 2px; cursor: pointer; font-size: 14px;line-height: normal; padding: 6px 10px;\">确定</span> <span id=\"MyidBoxCancel\" data-name=\"取消\" style=\"margin-right: 10px;background: #4d96df none repeat scroll 0 0; color: #fff; -moz-user-select: none;border-radius: 2px; cursor: pointer; font-size: 14px; line-height: normal; padding: 6px 10px;\">取消</span></div>";
    msgObj.innerHTML = boxInfo;

    document.body.appendChild(msgObj);
    var box = new LightBox("MyidBox", { "Width": "280px", "minHeight": "130px" });

    box.Show();

    $("#MyidBoxCancel").click(function () {
        document.body.removeChild(msgObj);
        box.Close();
    });

    $("#MybtnClose").click(function () {
        boxcallback(callbackParameter);
        document.body.removeChild(msgObj);
        box.Close();
    });

    $("#MybtnClose").focus();
}

function ExportFile(title, path) {//返回函数、返回参数、标题、内容
    var msgObj = document.createElement("div");

    msgObj.setAttribute("id", "MyidBox");
    msgObj.setAttribute("class", "lightbox");
    msgObj.style.width = "280px";
    msgObj.style.height = "auto";
    msgObj.style.background = "rgb(255, 255, 255) none repeat scroll 0% 0%";
    msgObj.style.borderRadius = "4px";
    msgObj.style.padding = "10px 16px";
    msgObj.style.boxShadow = "0 0 0 0 #fff";
    msgObj.style.position = "fixed";
    msgObj.style.top = "45%";
    msgObj.style.left = "45%";
    msgObj.style.minHeight = "130px";
    msgObj.style.minWidth = "240px";


    var boxInfo = "<div style=\"width: 280px; height: auto; background: rgb(250, 250, 250) none repeat scroll 0% 0%;border-radius: 4px; padding: 10px 16px; box-shadow: 0 0 0 0 #fff; position: fixed;left: 50%; min-height: 130px; min-width: 240px; top: 50%; transform: translate3d(-50%, -50%, 0px);\"><div style=\"border-bottom: 1px dashed #4d96df; color: #588cd2; font-size: 20px; overflow: hidden;padding: 10px 0; text-overflow: ellipsis; white-space: nowrap;\">下载</div><a title=\"点击文件名下载\" href=\"" + path + "\" download=\"" + title + "\" style=\"font-size: 14px;line-height: 1.6; padding: 14px 0 10px; text-indent: 16px; color: #313234; display: block\">" + title + "</a><div style=\"display: flex; float: right; height: 36px; justify-content: flex-end;overflow: hidden; padding: 3px 2px; text-overflow: ellipsis; white-space: nowrap;\"><span id=\"MyidBoxCancel\" data-name=\"确定\" style=\"margin-right: 10px; background: #4d96df none repeat scroll 0 0;color: #fff; -moz-user-select: none; border-radius: 2px; cursor: pointer; font-size: 14px;line-height: normal; padding: 6px 10px;\">确定</span></div></div>";
    msgObj.innerHTML = boxInfo;

    document.body.appendChild(msgObj);
    var box = new LightBox("MyidBox", { "Width": "280px", "minHeight": "130px" });

    box.Show();

    $("#MyidBoxCancel").click(function () {
        document.body.removeChild(msgObj);
        box.Close();
    });

    $("#MyidBoxCancel").focus();
}
